<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="24">
        <blockquote style="font-size: 14px">
          <!--    TODO 首页      -->
          <div>
            <el-col :xs="24" :lg="16" :md="16" >
              <div class="car-left">
                <el-col :xs="4" :md="3" :lg="3">
                  <span class="card-img">
<!--                    <img :src="userInfo.headerImg" alt="" />-->
                  </span>
                </el-col>
                <el-col :xs="20" :lg="12" :md="12">
                  <div class="text">
                    <h4>早安，管理员， 请开始您一天的工作吧！</h4>
                    <p class="tips-text">
                      <i class="el-icon-sunny el-icon"></i>
                      <span>今日晴，0℃ - 10℃，天气寒冷，注意添加衣物。</span>
                    </p>
                    <hr />
                  </div>
                </el-col>
              </div>
            </el-col>
            <el-col :xs="24" :lg='8' :md="8">
              <div class="car-right">
                <el-row>
                  <el-col :span="8">
                    <div class="car-item">
                      <span class="flow"><i class="el-icon-s-grid"></i></span>
                      <span>今日流量 </span>
                      <i></i>
                      <p class="tips-text">
                        <span>   13260</span>
                      </p>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="car-item">
                  <span class="user-number">
                    <i class="el-icon-s-custom"></i>
                  </span>
                      <span>总用户 </span>
                      <p class="tips-text">
                        <span>48286</span>
                      </p>
                    </div>
                  </el-col>
                  <el-col :span="8">
                    <div class="car-item">
                  <span class="feedback">
                    <i class="el-icon-star-on"></i>
                  </span>
                      <span>好评率 </span>
                      <p class="tips-text">
                        <span>98%</span>
                      </p>
                    </div>
                  </el-col>
                </el-row>
              </div>
            </el-col>
          </div>
        </blockquote>
      </el-col>
    </el-row>

    <el-row :gutter="20">
      <div class="shadow">
        <el-row :gutter="20">
          <el-col
            :span="6"
            v-for="(card, key) in toolCards"
            :key="key"
            @click.native="toTarget(card.name)"
            :xs="8">
            <el-card shadow="hover" class="grid-content">
              <i :class="card.icon" :style="{ color: card.color }">{{ card.label }}</i>
              <p></p>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </el-row>

    <el-row>
      <el-col :sm="24" :lg="24">
<!--        <div id="main" style="width: 600px;height:400px;"></div>-->
        <div id="main" style="width: 100%;height:400px;"></div>
      </el-col>
    </el-row>
    <el-row :gutter="20">
      <el-col :sm="24" :lg="12" style="padding-left: 20px">
        <h2>admin-springBoot-vue后台管理框架</h2>
        <p>
          <b>当前版本:</b> <span>v{{ version }}</span>
        </p>
        <p>
          <el-tag type="danger">&yen;免费开源</el-tag>
        </p>
        <p>
          <el-button
            type="primary"
            size="mini"
            icon="el-icon-cloudy"
            plain
            @click="goTarget('https://gitee.com/linxianqin/springboot-bucket-gradle')"
            >访问码云</el-button
          >
          <el-button
            size="mini"
            icon="el-icon-s-home"
            plain
            @click="goTarget('https://linxianqin.com/')"
            >访问主页</el-button
          >
        </p>
      </el-col>

      <el-col :sm="24" :lg="12" style="padding-left: 50px">
        <el-row>
          <el-col :span="12">
            <h2>技术选型</h2>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <h4>后端技术</h4>
            <ul>
              <li>SpringBoot</li>
              <li>Spring Security</li>
              <li>JWT</li>
              <li>MyBatis</li>
              <li>Druid</li>
              <li>Fastjson</li>
              <li>...</li>
            </ul>
          </el-col>
          <el-col :span="6">
            <h4>前端技术</h4>
            <ul>
              <li>Vue</li>
              <li>Vuex</li>
              <li>Element-ui</li>
              <li>Axios</li>
              <li>Sass</li>
              <li>Quill</li>
              <li>...</li>
            </ul>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <el-divider />
    <el-row :gutter="20">
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>联系信息</span>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>更新日志</span>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>捐赠支持</span>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "index",
  data() {
    return {
      // 版本号
      version: "1.0.0",
      toolCards: [
        {
          label: "用户管理",
          icon: "el-icon el-icon-monitor",
          name: "user",
          color: "#ff9c6e",
        },
        {
          label: "角色管理",
          icon: "el-icon el-icon-setting",
          name: "authority",
          color: "#69c0ff",
        },
        {
          label: "菜单管理",
          icon: "el-icon el-icon-menu",
          name: "menu",
          color: "#b37feb",
        },
        // {
        //   label: "代码生成器",
        //   icon: "el-icon el-icon-cpu",
        //   name: "autoCode",
        //   color: "#ffd666",
        // },
        // {
        //   label: "表单生成器",
        //   icon: "el-icon el-icon-document-checked",
        //   name: "formCreate",
        //   color: "#ff85c0",
        // },
        {
          label: "关于我们",
          icon: "el-icon el-icon-user",
          name: "about",
          color: "#5cdbd3",
        },
      ],
    };
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },
    toTarget(name) {
      this.$router.push({ name });
    },
    drawChart() {
      // 基于准备好的dom，初始化echarts实例
      let myChart = this.$echarts.init(document.getElementById("main"));
      // 指定图表的配置项和数据
      let option = {
        title: {
          text: "ECharts 入门示例"
        },
        tooltip: {},
        legend: {
          data: ["销量"]
        },
        xAxis: {
          data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
        },
        yAxis: {},
        series: [
          {
            name: "销量",
            type: "bar",
            data: [5, 20, 36, 10, 10, 20]
          }
        ]
      };
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    }
  },
  mounted() {
    this.drawChart();
  }
};
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>

